<template>
  <div class="addUser">
    <div class="header">添加用户</div>
    <div class="form">
      <el-form :model="ruleForm"
               :rules="rules"
               ref="ruleForm"
               label-width="100px"
               class="demo-ruleForm">
        <el-form-item label="菜单名称"
                      prop="username">
          <el-input v-model="ruleForm.username"></el-input>
        </el-form-item>
        <el-form-item label="链接地址"
                      prop="link">
          <el-input v-model="ruleForm.link"></el-input>
        </el-form-item>
        <el-form-item>
          <span>状态：</span>
          <el-radio v-model="radio"
                    label="0">正常</el-radio>
          <el-radio v-model="radio"
                    label="1">禁用</el-radio>
        </el-form-item>
        <el-form-item>
          <el-button type="primary">添加</el-button>
          <el-button>取消</el-button>
        </el-form-item>
      </el-form>
    </div>
  </div>
</template>
<script>
export default {
  data () {
    return {
      ruleForm: {
        username: "",
        link: ""
      },
      radio: "",
      rules: {
        username: [
          { required: true, message: "请输入用户名", trigger: "blur" },
          {
            min: 3,
            max: 5,
            message: "长度在 3 到 5 个字符",
            trigger: ["blur"]
          }
        ],
        link: [
          { required: true, message: "请输入链接地址", trigger: "blur" },
          {
            min: 3,
            max: 18,
            message: "请输入正确的链接地址",
            trigger: ["blur", "change"]
          }
        ]
      }
    };
  }
};
</script>
<style lang="less" scoped>
.addUser {
  padding: 20px;
  .header {
    height: 50px;
    border-bottom: 1px solid #ccc;
    font-size: 30px;
    font-weight: 900;
    margin-bottom: 100px;
  }
  .form {
    width: 400px;
    height: 300px;
    // background-color: yellow;
    margin: 0 auto;
  }
}
</style>